﻿using System.Collections.Generic;
using System.Linq;
using Airborne.ScrumPoker.Model.TeamFoundation;

namespace Airborne.ScrumPoker.Tests
{
    public class MockTeamProxy : ITeamFoundationProxy
    {
        #region ITeamFoundationProxy Members

        public bool Connect()
        {
            return true;
        }

        public ITeamProject[] GetProjects()
        {
            IList<ITeamProject> projects = new List<ITeamProject>();
            for (int i = 0; i < 10; i++)
            {
                projects.Add( new MockTeamProject(string.Concat("Project_", i)));
            }
            return projects.ToArray();
        }

        public ITeamWorkItem[] GetWorkItems(ITeamProject project, string workItemType)
        {
            IList<ITeamWorkItem> workItems = new List<ITeamWorkItem>();
            for (int i = 0; i < 10; i++)
            {
                workItems.Add(new SimpleWorkItem() { Title = string.Concat("WorkItem_", 1), Description = string.Concat("A description of the workitem in project ", project.Name) });
            }
            return workItems.ToArray();
        }

        public ITeamWorkItem[] GetWorkItems(ITeamProject project)
        {
            return GetWorkItems(project, string.Empty);
        }

        public bool IsConnected
        {
            get { return true; }
        }

        #endregion
    }
}
